package com.explorati.LeetCode070.climbingstairs;

import java.util.Arrays;

/**
 * @ Author : Weijian_Wang
 * @ Date : Created in 12:16 2020/10/6 0006
 * @ Description ：
 */
public class Solution1 {

    /**
     * 每次你可以爬 1 或 2 个台阶。你有多少种不同的方法可以爬到楼顶呢？
     *
     *
     * @param n
     * @return
     */
    public int climbStairs(int n) {

        int first = 1;
        int second = 2;
        int temp = 0;

        for(int i = 3; i <= n; i++) {
            temp = first + second;
            first = second;
            second = temp;
        }

        return second;
    }
}
